package com.nthink.indicators.mapper.operationindex;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nthink.indicators.pojo.operationindex.workload.Workload;
import com.nthink.indicators.pojo.pie.PieDataModel;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;

/**
 *
 */
@Mapper
public interface WorkloadMapper extends BaseMapper<Workload> {

    //region 普通指标

    /**
     * 门诊总人次
     * @param startTime
     * @param endTime
     * @return
     */
    public int getOutpatients(Date startTime, Date endTime);

    /**
     * 住院总人次
     * @param startTime
     * @param endTime
     * @return
     */
    public int getInpatients(Date startTime, Date endTime);

    /**
     * 急诊人次数
     * @param startTime
     * @param endTime
     * @return
     */
    public int getEmergencyPatients(Date startTime, Date endTime);


    /**
     * 死亡人数
     * @param startTime
     * @param endTime
     * @return
     */
    public int getDeath(Date startTime, Date endTime);


    /**
     * 住院病人手术人次数
     * @param startTime
     * @param endTime
     * @return
     */
    public int getOperationInInpatients(Date startTime, Date endTime);

    /**
     * 门诊病人手术人次数
     * @param startTime
     * @param endTime
     * @return
     */
    public int getOperationInOutpatients(Date startTime, Date endTime);

    /**
     * 出院手术患者人数
     * @param startTime
     * @param endTime
     * @return
     */
    public int getDischargedPatients(Date startTime, Date endTime);

    // endregion

    //region 药品指标

    public int getOutpatientPrescriptions(Date startTime, Date endTime);

    public int getAntibacterials(Date startTime, Date endTime);

    public int getAdverseDrugReactions(Date startTime, Date endTime);

    public int getOutPatientEssentialDrugs(Date startTime, Date endTime);

    public double getEssentialDrugsPurchasedRate(Date startTime, Date endTime);

    public double getEssentialDrugsRateByInpatients(Date startTime, Date endTime);

    //endregion

    //region  人次 - 年
    public int getOutYearPatients(Integer year);

    public int getInYearPatients(Integer year);

    public int getDischargeYearPatients(Integer year);
    //endregion

    //region  床位相关 - 年
    public int getTotalOpenBedDays(Integer year);

    public int getTotalUseBedDays(Integer year);

    public int getTotalBedDays(Integer year);

    public double getAverageHospitalDays(Integer year);

    public double getDaysPerBed(Integer year);

    public double getBedUseRate(Integer year);

    public double getBedUseCount(Integer year);
    //endregion

    /**
     * 住院手术等级分布
     * @param startTime
     * @param endTime
     * @return
     */
    public List<PieDataModel> getOperationInfo(Date startTime, Date endTime);

}
